<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // async function test () {
        //   await console.log('test-state')
        //   await console.log('test-2')
        //   console.log('test-3');
        //   await console.log('test-4');
        //   console.log('test-end')

        // }
        // test()
        // console.log('window-state')
        // console.log('window-end')
        // async 函数执行时 遇到await会立即执行, 然后把后面的代码表达式放到微任务里, 让执行栈里的同步任务代码先执行.

        // test-state
        // w-s
        // w-e
        // t-2
        // t-3
        // t-4
        // test-end
    </script>
</body>
</html>